//
//  TableViewCell2.m
//  NEWS
//
//  Created by lanou on 16/4/7.
//  Copyright © 2016年 孙金龙. All rights reserved.
//

#import "TableViewCell2.h"
#import <UIImageView+WebCache.h>
#define KWidth [UIScreen mainScreen].bounds.size.width
#define KHeight  [UIScreen mainScreen].bounds.size.height
@implementation TableViewCell2

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        _image1 = [[UIImageView alloc] initWithFrame:CGRectMake(10, 30, 115, 110)];
        _image1.backgroundColor = [UIColor orangeColor];
        [self.contentView addSubview:_image1];
        
        _image2 = [[UIImageView alloc] initWithFrame:CGRectMake(10+(KWidth-20)/3, 30, 115, 110)];
        _image2.backgroundColor = [UIColor orangeColor];
        [self.contentView addSubview:_image2];
        
        _image3 = [[UIImageView alloc] initWithFrame:CGRectMake(10+2*(KWidth-20)/3, 30, 115, 110)];
        _image3.backgroundColor = [UIColor orangeColor];
        [self.contentView addSubview:_image3];
        
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 5, KWidth-5, 20)];
        _titleLabel.numberOfLines = 0;
        _titleLabel.font = [UIFont systemFontOfSize:14];
        //_titleLabel.backgroundColor = [UIColor grayColor];
        [self.contentView addSubview:_titleLabel];

    }
    return self;
}

- (void)setModel:(TableViewModel *)model
{
    [_image1 sd_setImageWithURL:[NSURL URLWithString:model.images[0]]];
    [_image2 sd_setImageWithURL:[NSURL URLWithString:model.images[1]]];
    [_image3 sd_setImageWithURL:[NSURL URLWithString:model.images[2]]];
    _titleLabel.text = model.title;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
